<template>
	<view>
		<view class="con" v-for="(item,index) in notesList" :key="index">
			<view class="box">
				<view class="box-left">
					<view class="box-title">
						<text>{{item.type}}</text>
					</view>
					<view class="box-time">
						<text>{{getTime(item.createTime)}}</text>
					</view>
				</view>
				<view class="box-right">
					<view class="box-price">
						<text>{{getPrice(parseFloat(item.price) /100 )}}</text>
					</view>
					<view class="box-state">
						<text v-if="item.state == '1'">成功</text>
						<text v-if="item.state == '2'">失败</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		queryNotesList
	} from '@/api/http/main/my/notes.js'

	import {
		handlePrice
	} from '@/utils/price.js'

	import {
		handleNowTime
	} from '@/utils/time/time.js'

	export default {
		data() {
			return {
				userId: uni.getStorageSync('userId'),
				notesList: []
			}
		},
		methods: {
			getPrice(price) {
				return handlePrice(price)
			},
			getTime(time) {
				return handleNowTime(time)
			},
			queryNotesList() {
				queryNotesList(this.userId, '2').then(res => {
					if (res.data.pubInfo.code !== 0) {
						return uni.$showMsg(res.data.pubInfo.message);
					}
					this.notesList = res.data.busInfo
				})
			}
		},
		onLoad() {
			this.queryNotesList()
		}
	}
</script>

<style lang="scss" scoped>
	.box {
		display: flex;
		justify-content: space-between;
		width: 94%;
		margin-left: 3%;
		height: 100rpx;

		.box-left {
			.box-title {
				height: 50rpx;
				font-size: 32rpx;
			}

			.box-time {
				line-height: 50rpx;
				font-size: 26rpx;
				color: #bfbfbf;
			}
		}

		.box-right {
			.box-price {
				height: 50rpx;
				font-size: 32rpx;

				text {
					color: red;
				}
			}

			.box-state {
				height: 50rpx;
				font-size: 30rpx;
				text-align: right;
			}
		}

	}
</style>